	.code16gcc
	.global _start
	.text
_start:
	movw $0,%ax
	movw %ax,%ss
	movw %ax,%sp	#堆栈从0xffff开始向下生长
	movw $0x1000,%ax	#ds指向0x1000
	movw %ax,%ds

	lgdt gdt_descr
	inb $0x92,%al
	orb $0x02,%al
	outb %al,$0x92
	cli
	movl %cr0,%eax
	or $1,%eax
	movl %eax,%cr0
    ljmp $0x08,$1f

1:
	movw $0x10,%ax
	movw %ax,%ds
	movw %ax,%es
	movw %ax,%fs
	movw %ax,%gs
	movw $0x18,%ax
	movw %ax,%ss
	calll *funcaddr
2:
	jmp 2b

funcaddr:
	.long __start+0x10000

gdt_descr:
	.word 31
	.long gdt+0x10000

gdt:
	.quad 0x0000000000000000
	.quad 0x00cf98000000ffff #代码段 base addr 0x00,limit:32G
	.quad 0x00cf92000000ffff #数据段 base 0x0, limit 32G
	.quad 0x00c0960000000000 #堆栈段 base 0x0, limit 32G




